home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / Balloons.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  11KB  |  286 lines

  1. /*
  2.      File:        Balloons.h
  3.  
  4.      Contains:    Balloon Help Package Interfaces.
  5.  
  6.      Version:    Technology:    Copland
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __BALLOONS__
  19. #define __BALLOONS__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27. #ifndef __MENUS__
  28. #include <Menus.h>
  29. #endif
  30. #ifndef __APPLEEVENTS__
  31. #include <AppleEvents.h>
  32. #endif
  33. #ifndef __TEXTSERVICES__
  34. #include <TextServices.h>
  35. #endif
  36. #ifndef __TEXTEDIT__
  37. #include <TextEdit.h>
  38. #endif
  39. #ifndef __ERRORS__
  40. #include <Errors.h>
  41. #endif
  42. #ifndef __COACHMARKS__
  43. #include <CoachMarks.h>
  44. #endif
  45. #ifndef __HIOBJECTTYPES__
  46. #include <HIObjectTypes.h>
  47. #endif
  48.  
  49. #ifdef __cplusplus
  50. extern "C" {
  51. #endif
  52.  
  53. #if PRAGMA_IMPORT_SUPPORTED
  54. #pragma import on
  55. #endif
  56.  
  57. #if PRAGMA_ALIGN_SUPPORTED
  58. #pragma options align=mac68k
  59. #endif
  60.  
  61. /* Cool for both System 7 and 8*/
  62. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  63.  
  64. enum {
  65.     kTopLeftTipPointsLeftVariant = 0,
  66.     kTopLeftTipPointsUpVariant    = 1,
  67.     kTopRightTipPointsUpVariant    = 2,
  68.     kTopRightTipPointsRightVariant = 3,
  69.     kBottomRightTipPointsRightVariant = 4,
  70.     kBottomRightTipPointsDownVariant = 5,
  71.     kBottomLeftTipPointsDownVariant = 6,
  72.     kBottomLeftTipPointsLeftVariant = 7,
  73.     kBalloonVariantCount        = 8
  74. };
  75.  
  76. typedef SInt16 BalloonVariant;
  77. /* * remove the currently onscreen balloon, if any*/
  78. extern pascal OSErr HMRemoveBalloon(void )
  79.  THREEWORDINLINE(0x303C, 0x0002, 0xA830);
  80.  
  81. #endif
  82. /* * Old API--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
  83. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  84.  
  85. enum {
  86.     hmBalloonHelpVersion        = 0x0002,                        /* The real version of the Help Manager */
  87.     kHMHelpMenuID                = -16490,                        /* Resource ID and menu ID of help menu */
  88.     kHMAboutHelpItem            = 1,                            /* help menu item number of About Balloon Help... */
  89.     kHMShowBalloonsItem            = 3,                            /* help menu item number of Show/Hide Balloons */
  90.     kHMHelpID                    = -5696,                        /* ID of various Help Mgr package resources (in Pack14 range) */
  91.     kBalloonWDEFID                = 126,                            /* Resource ID of the WDEF proc used in standard balloons */
  92.                                                                 /* Dialog item template type constant */
  93.     helpItem                    = 1,                            /* key value in DITL template that corresponds to the help item */
  94.                                                                 /* Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  95.     hmDefaultOptions            = 0,                            /* default options for help manager resources */
  96.     hmUseSubID                    = 1,                            /* treat resID's in resources as subID's of driver base ID (for Desk Accessories) */
  97.     hmAbsoluteCoords            = 2                                /* ignore window port origin and treat rectangles as absolute coords (local to window) */
  98. };
  99.  
  100.  
  101. enum {
  102.     hmSaveBitsNoWindow            = 4,                            /* don't create a window, just blast bits on screen. No update event is generated */
  103.     hmSaveBitsWindow            = 8,                            /* create a window, but restore bits behind window when window goes away & generate update event */
  104.     hmMatchInTitle                = 16,                            /* for hwin resources, match string anywhere in window title string */
  105.                                                                 /* Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  106.     kHMStringItem                = 1,                            /* pstring used in resource */
  107.     kHMPictItem                    = 2,                            /* 'PICT' ResID used in resource */
  108.     kHMStringResItem            = 3,                            /* 'STR#' ResID & index used in resource */
  109.     kHMTEResItem                = 6,                            /* Styled Text Edit ResID used in resource ('TEXT' & 'styl') */
  110.     kHMSTRResItem                = 7,                            /* 'STR ' ResID used in resource */
  111.     kHMSkipItem                    = 256,                            /* don't display a balloon */
  112.     kHMCompareItem                = 512,                            /* Compare pstring in menu item w/ PString in resource item ('hmnu' only) */
  113.     kHMNamedResourceItem        = 1024,                            /* Use pstring in menu item to get 'STR#', 'PICT', or 'STR ' resource ('hmnu' only) */
  114.     kHMTrackCntlItem            = 2048,                            /* Reserved */
  115.                                                                 /* Constants for hmmHelpType's when filling out HMMessageRecord */
  116.     khmmString                    = 1,                            /* help message contains a PString */
  117.     khmmPict                    = 2,                            /* help message contains a resource ID to a 'PICT' resource */
  118.     khmmStringRes                = 3,                            /* help message contains a res ID & index to a 'STR#' resource */
  119.     khmmTEHandle                = 4,                            /* help message contains a Text Edit handle */
  120.     khmmPictHandle                = 5,                            /* help message contains a Picture handle */
  121.     khmmTERes                    = 6,                            /* help message contains a res ID to 'TEXT' & 'styl' resources */
  122.     khmmSTRRes                    = 7,                            /* help message contains a res ID to a 'STR ' resource */
  123.     kHMEnabledItem                = 0                                /* item is enabled, but not checked or control value = 0 */
  124. };
  125.  
  126.  
  127. enum {
  128.                                                                 /* ResTypes for Styled TE Handles in Resources */
  129.     kHMTETextResType            = 'TEXT',                        /* Resource Type of text data for styled TE record w/o style info */
  130.     kHMTEStyleResType            = 'styl'                        /* Resource Type of style information for styled TE record */
  131. };
  132.  
  133.  
  134. enum {
  135.     kHMDisabledItem                = 1,                            /* item is disabled, grayed in menus or disabled in dialogs */
  136.     kHMCheckedItem                = 2,                            /* item is enabled, and checked or control value = 1 */
  137.     kHMOtherItem                = 3,                            /* item is enabled, and control value > 1 */
  138.                                                                 /* Method parameters to pass to HMShowBalloon */
  139.     kHMRegularWindow            = 0,                            /* Create a regular window floating above all windows */
  140.     kHMSaveBitsNoWindow            = 1,                            /* Just save the bits and draw (for MDEF calls) */
  141.     kHMSaveBitsWindow            = 2                                /* Regular window, save bits behind, AND generate update event */
  142. };
  143.  
  144.  
  145. enum {
  146.                                                                 /* Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg' messages */
  147.     kHMMenuResType                = 'hmnu',                        /* ResType of help resource for supporting menus */
  148.     kHMDialogResType            = 'hdlg',                        /* ResType of help resource for supporting dialogs */
  149.     kHMWindListResType            = 'hwin',                        /* ResType of help resource for supporting windows */
  150.     kHMRectListResType            = 'hrct',                        /* ResType of help resource for rectangles in windows */
  151.     kHMOverrideResType            = 'hovr',                        /* ResType of help resource for overriding system balloons */
  152.     kHMFinderApplResType        = 'hfdr'                        /* ResType of help resource for custom balloon in Finder */
  153. };
  154.  
  155. struct HMStringResType {
  156.     short                             hmmResID;
  157.     short                             hmmIndex;
  158. };
  159. typedef struct HMStringResType HMStringResType;
  160.  
  161. struct HMMessageRecord {
  162.     SInt16                             hmmHelpType;
  163.     union {
  164.         Str255                             hmmString;
  165.         SInt16                             hmmPict;
  166.         TEHandle                         hmmTEHandle;
  167.         HMStringResType                 hmmStringRes;
  168.         SInt16                             hmmPictRes;
  169.         PicHandle                         hmmPictHandle;
  170.         SInt16                             hmmTERes;
  171.         SInt16                             hmmSTRRes;
  172.     }                                 u;
  173. };
  174. typedef struct HMMessageRecord HMMessageRecord;
  175.  
  176. typedef HMMessageRecord *HMMessageRecPtr;
  177. typedef pascal OSErr (*TipFunctionProcPtr)(Point tip, RgnHandle structure, Rect *r, BalloonVariant *balloonVariant);
  178.  
  179. #if GENERATINGCFM
  180. typedef UniversalProcPtr TipFunctionUPP;
  181. #else
  182. typedef TipFunctionProcPtr TipFunctionUPP;
  183. #endif
  184.  
  185. enum {
  186.     uppTipFunctionProcInfo = kPascalStackBased
  187.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  188.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Point)))
  189.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(RgnHandle)))
  190.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Rect *)))
  191.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(BalloonVariant *)))
  192. };
  193.  
  194. #if GENERATINGCFM
  195. #define NewTipFunctionProc(userRoutine)        \
  196.         (TipFunctionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppTipFunctionProcInfo, GetCurrentArchitecture())
  197. #else
  198. #define NewTipFunctionProc(userRoutine)        \
  199.         ((TipFunctionUPP) (userRoutine))
  200. #endif
  201.  
  202. #if GENERATINGCFM
  203. #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant)        \
  204.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppTipFunctionProcInfo, (tip), (structure), (r), (balloonVariant))
  205. #else
  206. #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant)        \
  207.         (*(userRoutine))((tip), (structure), (r), (balloonVariant))
  208. #endif
  209. /*  Public Interfaces  */
  210. extern pascal OSErr HMGetHelpMenuHandle(MenuRef *mh)
  211.  THREEWORDINLINE(0x303C, 0x0200, 0xA830);
  212.  
  213. extern pascal OSErr HMShowBalloon(const HMMessageRecord *aHelpMsg, Point tip, RectPtr alternateRect, TipFunctionUPP tipProc, SInt16 theProc, BalloonVariant balloonVariant, SInt16 method)
  214.  THREEWORDINLINE(0x303C, 0x0B01, 0xA830);
  215.  
  216. extern pascal OSErr HMShowMenuBalloon(SInt16 itemNum, SInt16 itemMenuID, SInt32 itemFlags, SInt32 itemReserved, Point tip, RectPtr alternateRect, TipFunctionUPP tipProc, SInt16 theProc, BalloonVariant balloonVariant)
  217.  THREEWORDINLINE(0x303C, 0x0E05, 0xA830);
  218.  
  219. extern pascal OSErr HMGetIndHelpMsg(ResType whichType, SInt16 whichResID, SInt16 whichMsg, SInt16 whichState, UInt32 *options, Point *tip, Rect *altRect, SInt16 *theProc, BalloonVariant *balloonVariant, HMMessageRecord *aHelpMsg, SInt16 *count)
  220.  THREEWORDINLINE(0x303C, 0x1306, 0xA830);
  221.  
  222. extern pascal Boolean HMIsBalloon(void )
  223.  THREEWORDINLINE(0x303C, 0x0007, 0xA830);
  224.  
  225. extern pascal Boolean HMGetBalloons(void )
  226.  THREEWORDINLINE(0x303C, 0x0003, 0xA830);
  227.  
  228. extern pascal OSErr HMSetBalloons(Boolean flag)
  229.  THREEWORDINLINE(0x303C, 0x0104, 0xA830);
  230.  
  231. extern pascal OSErr HMSetFont(SInt16 font)
  232.  THREEWORDINLINE(0x303C, 0x0108, 0xA830);
  233.  
  234. extern pascal OSErr HMSetFontSize(UInt16 fontSize)
  235.  THREEWORDINLINE(0x303C, 0x0109, 0xA830);
  236.  
  237. extern pascal OSErr HMGetFont(SInt16 *font)
  238.  THREEWORDINLINE(0x303C, 0x020A, 0xA830);
  239.  
  240. extern pascal OSErr HMGetFontSize(UInt16 *fontSize)
  241.  THREEWORDINLINE(0x303C, 0x020B, 0xA830);
  242.  
  243. extern pascal OSErr HMSetDialogResID(SInt16 resID)
  244.  THREEWORDINLINE(0x303C, 0x010C, 0xA830);
  245.  
  246. extern pascal OSErr HMSetMenuResID(SInt16 menuID, SInt16 resID)
  247.  THREEWORDINLINE(0x303C, 0x020D, 0xA830);
  248.  
  249. extern pascal OSErr HMBalloonRect(const HMMessageRecord *aHelpMsg, Rect *coolRect)
  250.  THREEWORDINLINE(0x303C, 0x040E, 0xA830);
  251.  
  252. extern pascal OSErr HMBalloonPict(const HMMessageRecord *aHelpMsg, PicHandle *coolPict)
  253.  THREEWORDINLINE(0x303C, 0x040F, 0xA830);
  254.  
  255. extern pascal OSErr HMScanTemplateItems(SInt16 whichID, SInt16 whichResFile, ResType whichType)
  256.  THREEWORDINLINE(0x303C, 0x0410, 0xA830);
  257.  
  258. extern pascal OSErr HMExtractHelpMsg(ResType whichType, SInt16 whichResID, SInt16 whichMsg, SInt16 whichState, HMMessageRecord *aHelpMsg)
  259.  THREEWORDINLINE(0x303C, 0x0711, 0xA830);
  260.  
  261. extern pascal OSErr HMGetDialogResID(SInt16 *resID)
  262.  THREEWORDINLINE(0x303C, 0x0213, 0xA830);
  263.  
  264. extern pascal OSErr HMGetMenuResID(SInt16 menuID, SInt16 *resID)
  265.  THREEWORDINLINE(0x303C, 0x0314, 0xA830);
  266.  
  267. extern pascal OSErr HMGetBalloonWindow(WindowRef *window)
  268.  THREEWORDINLINE(0x303C, 0x0215, 0xA830);
  269.  
  270. #endif
  271.  
  272. #if PRAGMA_ALIGN_SUPPORTED
  273. #pragma options align=reset
  274. #endif
  275.  
  276. #if PRAGMA_IMPORT_SUPPORTED
  277. #pragma import off
  278. #endif
  279.  
  280. #ifdef __cplusplus
  281. }
  282. #endif
  283.  
  284. #endif /* __BALLOONS__ */
  285.  
  286.